<?php
/**
 * Gold - Repay
 * 
 * NOTICE OF LICENSE
 * 
 * This source file is subject to the Gold Repay POINTS AND REWARDS 
 * License, which extends the Open Software License (OSL 3.0).
 * The Repay License is available at this URL: 
 * 
 * DISCLAIMER
 * 
 * By adding to, editing, or in any way modifying this code, Gold is 
 * not held liable for any inconsistencies or abnormalities in the 
 * behaviour of this code. 
 * By adding to, editing, or in any way modifying this code, the Licensee
 * terminates any agreement of support offered by Gold, outlined in the 
 * provided Repay License. 
 * Upon discovery of modified code in the process of support, the Licensee 
 * is still held accountable for any and all billable time Gold spent 
 * during the support process.
 * Gold does not guarantee compatibility with any other framework extension. 
 * Gold is not responsbile for any inconsistencies or abnormalities in the
 * behaviour of this code if caused by other framework extension.
 * If you did not receive a copy of the license, please send an email to 
 * contact@Gold.ca or call 1-888-699-Gold(9322), so we can send you a copy 
 * immediately.
 * 
 * @category    Gold
 * @package     Gold_Repay
 * @copyright   Copyright (c) 2011 Gold
 * @Author $Id: config.xml 11 2011-06-22 09:19:46Z gold $
 */
class Gold_Repay_Block_Rewards_Rewardearned extends Mage_Core_Block_Template {
	
	protected function _construct() {
		parent::_construct ();
		$this->setTemplate ( 'repay/rewards/rewardearned.phtml' ); // TODO: move this to rewards.xml file.
	}
	
	public function getPointsEarned() {
	    $points_earned = $this->getTotal()->getValue();
		$earned_str = Mage::helper ( 'rewards' )->getPointsString ( $points_earned );
		return $earned_str;
	}
	
	/**
	 * Show the earnings row?
	 *
	 * @return boolean
	 */
	public function showEarnings() {
		if (Mage::helper ( 'rewards/config' )->showCartDistributionsWhenZero ()) {
			$doShow = true;
		} else {
			$doShow = false;
		}
		return $doShow;
	}
		
	protected function _toHtml() {
		if (Mage::helper ( 'rewards' )->isMultishipMode ()) {
			return '';
		} else {
			return parent::_toHtml ();
		}
	}

}
